<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="合同编号" prop="sn">
        <el-input
          v-model="queryParams.sn"
          placeholder="请输入合同编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['procurementmanagement:contract:add']"
        >新增</el-button>
      </el-col>
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="success"-->
      <!--          plain-->
      <!--          icon="el-icon-edit"-->
      <!--          size="mini"-->
      <!--          :disabled="single"-->
      <!--          @click="handleUpdate"-->
      <!--          v-hasPermi="['procurementmanagement:contract:edit']"-->
      <!--        >修改</el-button>-->
      <!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['procurementmanagement:contract:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-close"
          size="mini"
          @click="handleCloseContract"
          v-hasPermi="['procurementmanagement:contract:close']"
        >关闭合同</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-check"
          size="mini"
          @click="handleExecuteContract"
          v-hasPermi="['procurementmanagement:contract:execute']"
        >执行合同</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="合同编号" align="center" prop="sn" />
      <el-table-column label="签订时间" align="center" prop="signTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.signTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="供应商名称" align="center" prop="supplierName" />
      <el-table-column label="合同状态" align="center" prop="contractStatus" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <!-- 只有当合同状态为“未执行”时，才显示“修改”按钮 -->
          <el-button
            v-if="scope.row.contractStatus === '未执行'"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['procurementmanagement:contract:edit']"
          >修改</el-button>

          <!-- 删除按钮始终显示 -->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['procurementmanagement:contract:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改采购合同(es_procurement_contract)对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="合同编号" prop="sn">
          <el-input v-model="form.sn" placeholder="合同编号" style="width: 220px" disabled></el-input>
        </el-form-item>
        <el-form-item label="签订时间" prop="signTime">
          <el-date-picker clearable
                          v-model="form.signTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择签订时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="供应商名称" prop="supplierName">
          <el-button
            @click="handleSupplierDialog"
            style="background-color: blue; color: white;"
          >选择</el-button>{{ form.supplierName || '请选择供应商' }}
        </el-form-item>
        <el-form-item label="编制人">
          <el-cascader
            v-model="form.creatorId"
            :options="personList"
            :props="{ checkStrictly: true, value: 'id', label: 'realName' }"
            placeholder="请选择编制人"
            @change="handleCreatorChange">
          </el-cascader>
        </el-form-item>

        <el-form-item label="制单时间" prop="creatorTime">
          <el-date-picker clearable
                          v-model="form.creatorTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择制单时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="合同附件" prop="contractAnnex">
          <el-input v-model="form.contractAnnex" style="width: 220px" placeholder="请输入合同附件" />
        </el-form-item>
        <el-form-item label="说明" prop="contractDesc">
          <el-input v-model="form.contractDesc" type="textarea" style="width: 350px" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="是否删除" prop="disabled">
          <el-radio-group v-model="form.disabled">
            <el-radio :label="0">否</el-radio>
            <el-radio :label="1">是</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="采购计划" prop="supplierName">
          <el-button
            @click="handleProcurementPlanDialog"
            style="background-color: blue; color: white;"
          > 选择</el-button>{{ form.planSn || '请选择采购计划' }}
        </el-form-item>

        <!-- 合同明细表格 -->
        <h3>合同明细</h3>
        <el-table :data="selectedGoods" border style="width: 100%; margin-bottom: 20px">
          <el-table-column prop="goodsSn" label="商品编号" width="120"></el-table-column>
          <el-table-column prop="goodsName" label="商品名称" width="150"></el-table-column>
          <el-table-column prop="specification" label="规格型号" width="120"></el-table-column>
          <el-table-column label="单位" width="80">
            <template slot-scope="scope">
              <span>{{ scope.row.unit || '个' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="单价" width="120">
            <template slot-scope="scope">
              <el-input-number
                v-model="scope.row.price"
                :min="0"
                :precision="2"
                size="mini"
                placeholder="单价"
                @change="calculateTotal(scope.row)">
              </el-input-number>
            </template>
          </el-table-column>
          <el-table-column label="数量" width="120">
            <template slot-scope="scope">
              <el-input-number
                v-model="scope.row.num"
                :min="1"
                size="mini"
                placeholder="数量"
                @change="calculateTotal(scope.row)">
              </el-input-number>
            </template>
          </el-table-column>
          <el-table-column label="税率(%)" width="120">
            <template slot-scope="scope">
              <el-input-number
                v-model="scope.row.taxRate"
                :min="0"
                :max="100"
                :step="1"
                :precision="2"
                size="mini"
                placeholder="税率"
                @change="calculateTotal(scope.row)">
              </el-input-number>
            </template>
          </el-table-column>
          <el-table-column label="合价" width="120">
            <template slot-scope="scope">
              <span>{{ calculateItemTotal(scope.row) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleRemoveGoods(scope.$index)"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 供应商选择器弹出窗口 -->
    <el-dialog :visible.sync="supplierDialogVisible" title="选择供应商" width="1000px">
      <el-table :data="supplierList">
        <el-table-column label="选择" width="55">
          <template slot-scope="scope">
            <el-radio
              v-model="selectedSupplierId"
              :label="scope.row.id"
              @change="handleSupplierRadioChange(scope.row)"
              class="custom-radio"
              :aria-hidden="false">
            </el-radio>
          </template>
        </el-table-column>
        <el-table-column prop="customName" label="供应商名称"></el-table-column>
        <el-table-column prop="customSn" label="供应商编码"></el-table-column>
        <el-table-column prop="productionAddress" label="地址"></el-table-column>
        <el-table-column prop="transfer" label="传真"></el-table-column>
        <el-table-column prop="linkman" label="联系人"></el-table-column>
        <el-table-column prop="telephone" label="电话"></el-table-column>
        <el-table-column prop="email" label="电子邮件"></el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="supplierDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="confirmSupplierSelection">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog :visible.sync="planListDialogVisible" title="选择采购计划" width="900px">
      <el-table
        :data="planList"
        @row-click="handlePlanListRowClick"
        highlight-current-row
        ref="planTable"
      >
        <el-table-column label="选择" width="55">
          <template slot-scope="scope">
            <el-radio
              v-model="selectedPlanId"
              :label="scope.row.id"
              @change="handlePlanRadioChange(scope.row)"
              class="custom-radio"
            ></el-radio>
          </template>
        </el-table-column>
        <el-table-column prop="sn" label="采购计划编号"></el-table-column>
        <el-table-column prop="deptName" label="所属部门"></el-table-column>
        <el-table-column prop="formationPerson" label="编制人员"></el-table-column>
        <el-table-column prop="procurementDesc" label="采购说明"></el-table-column>
        <el-table-column prop="formationTime" label="编制日期"></el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="planListDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="confirmPlanSelection">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listContract,
  getContract,
  delContract,
  addContract,
  updateContract,
  updateContractStatus
} from "@/api/procurementmanagement/contract";
import {getCompiler, getPlan, getSupplierList, getsupplierListBid, listPlan} from "@/api/procurementmanagement/plan";

export default {
  name: "Contract",
  data() {
    return {
      selectedPlanId: null, // 新增：选中的采购计划ID
      selectedSupplierId: null,
      selectedGoods: [], // 合同明细（商品列表）
      isDisabledModified: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedEsProcurementContractProduct: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 采购合同(es_procurement_contract)表格数据
      contractList: [],
      // 采购合同产品(es_procurement_contract_product)表格数据
      esProcurementContractProductList: [],
      // 采购计划(es_procurement_plan)表格数据
      planList: [],
      selectedplan:null,
      //制表人
      personList:[],
      supplierDialogVisible: false,
      planListDialogVisible: false,
      selectedSupplier: null,
      //供应商
      supplierList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        sn: null,
        signTime: null,
        supplierName: null,
        contractStatus: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handlePlanRadioChange(row) {
      this.selectedPlan = row;
      this.selectedPlanId = row.id;
    },
    /** 查询采购合同(es_procurement_contract)列表 */
    getList() {
      this.loading = true;
      listContract(this.queryParams).then(response => {
        this.contractList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        sn: null,
        signTime: null,
        supplierId: null,
        supplierName: null,
        creatorId: null,
        creator: null,
        creatorTime: null,
        contractAnnex: null,
        contractDesc: null,
        createTime: null,
        contractStatus: null,
        disabled: null,
        planId: null,
        planSn: null
      };
      this.esProcurementContractProductList = [];
      this.selectedGoods = []; // 清空合同明细数据
      this.resetForm("form");
    },
    handleSupplierDialog() {
      console.log("供应商选择器弹窗被打开");
      this.getSupplierList(); // 获取供应商列表
      this.supplierDialogVisible = true; // 显示供应商选择器弹窗
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    /** 新增按钮操作 */
    handleAdd() {
      this.reset(); // 重置表单
      this.getCompiler(); // 获取编制人

      // 清空合同明细数据
      this.selectedGoods = [];

      // 获取当前日期作为默认签订时间
      const now = new Date();
      const signTime = now.toISOString().slice(0, 10); // 格式化为 YYYY-MM-DD
      this.form.signTime = signTime;

      // 根据签订时间生成合同编号
      this.generateContractNumber(signTime);

      // 设置合同状态为“未执行”
      this.form.contractStatus = '未执行';

      this.open = true;
      this.title = "添加采购合同(es_procurement_contract)";
    },
    generateContractNumber(signTime) {
      const prefix = "CT"; // 编号前缀
      const formattedDate = signTime.replace(/-/g, ""); // 将日期格式化为 YYYYMMDD
      let seq = 1; // 默认序列号为 1

      // 假设从后端获取当天的合同数量
      this.getContractCountByDate(signTime).then(count => {
        seq = count + 1; // 当天的合同数量加1
        const formattedSeq = String(seq).padStart(4, "0"); // 序列号格式化为 0001
        this.form.sn = `${prefix}${formattedDate}${formattedSeq}`; // 拼接编号
      });
    },
    getContractCountByDate(date) {
      // 调用后端接口获取当天的合同数量
      return new Promise((resolve, reject) => {
        // 示例：调用后端接口
        listContract({ signTime: date }).then(response => {
          resolve(response.total); // 返回当天的合同数量
        }).catch(error => {
          console.error("获取合同数量失败", error);
          resolve(0); // 如果失败，默认返回0
        });
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset(); // 重置表单
      const id = row.id || this.ids;
      getContract(id).then(response => {
        this.form = response.data; // 填充表单数据
        this.esProcurementContractProductList = response.data.esProcurementContractProductList;

        // 映射 esProcurementContractProductList 到 selectedGoods
        this.selectedGoods = response.data.esProcurementContractProductList.map(item => ({
          id: item.id,
          goodsId: item.goodsId,
          goodsSn: item.goodsSn,
          goodsName: item.goodsName,
          specification: item.specification,
          price: item.price,
          num: item.num,
          taxRate: item.taxRate, // 转换为百分比
          remark: item.remark
        }));

        this.getCompiler(); // 获取编制人
        this.open = true; // 打开表单弹窗
        this.title = "修改采购合同(es_procurement_contract)";
      });
    },
    //获取编制人
    getCompiler(){
      getCompiler().then(response => {
        this.personList = response.data;
      })
    },
    handleProcurementPlanDialog() {
      this.listPlan();
      this.planListDialogVisible = true;
    },

// 获取供应商列表
    getSupplierList() {
      getSupplierList().then(response => {
        this.supplierList = response.data;
      }).catch(error => {
        console.error("获取供应商列表失败", error);
        this.$message.error("获取供应商列表失败");
      });
    },
    listPlan(){
      listPlan(this.queryParams).then(response => {
        this.planList = response.rows;
        this.total = response.total;
      });
    },
    handlePlanListRowClick(row, column, event) {
      if (column.type === "radio") {
        this.$refs.planTable.setCurrentRow(row); // 设置当前选中的行
        this.selectedplan = row; // 保存选中的采购计划
      }
    },

// 处理供应商行点击事件
    handleSupplierRowClick(row, column, event) {
      if (column.type === "radio") {
        this.$refs.supplierTable.setCurrentRow(row); // 设置当前选中的行
        this.selectedSupplier = row; // 保存选中的供应商
      }
    },
    handleSupplierRadioChange(row) {
      this.selectedSupplier = row;
      this.selectedSupplierId = row.id; // 手动设置选中的供应商ID
    },
    // 确认选择供应商
    confirmSupplierSelection() {
      if (this.selectedSupplier) {
        this.form.supplierName = this.selectedSupplier.customName;
        this.form.supplierId = this.selectedSupplier.id;
        this.supplierDialogVisible = false;
      } else {
        this.$message.warning("请选择一个供应商");
      }
    },
    // 计算单个商品的总价
    calculateItemTotal(item) {
      if (!item.price || !item.num) return '0.00';
      const subtotal = item.price * item.num;
      const tax = subtotal * (item.taxRate / 100);
      const total = subtotal + tax;
      return total.toFixed(2);
    },

    // 计算所有商品的总价
    calculateTotal() {
      let total = 0;
      this.selectedGoods.forEach(item => {
        const subtotal = item.price * item.num;
        const tax = subtotal * (item.taxRate / 100);
        total += subtotal + tax;
      });
      return total.toFixed(2);
    },

    // 当单价、数量或税率变化时重新计算
    handleValueChange(row) {
      row.total = this.calculateItemTotal(row);
    },
    // 在confirmPlanSelection方法中，修改商品映射逻辑
    confirmPlanSelection() {
      if (this.selectedPlan) {
        getPlan(this.selectedPlan.id).then(response => {
          console.log("采购计划详细数据:", response.data);
          this.form.planSn = response.data.sn;
          this.form.planId = this.selectedPlan.id;

          // 清空现有商品列表
          this.selectedGoods = [];

          // 确保productList存在且有数据
          if (response.data.productList && response.data.productList.length > 0) {
            this.selectedGoods = response.data.productList.map(item => ({
              id: item.id || null, // 保留原ID或设为null
              goodsId: item.goodsId,
              goodsSn: item.goodsSn,
              goodsName: item.goodsName,
              specification: item.specification,
              price: item.costPrice || 0, // 默认价格为0
              num: item.procurementNum || 1, // 默认数量为1
              taxRate: item.taxRate ? parseFloat(item.taxRate) : 0, // 转换为数字
              remark: item.remark || '',
              categoryId: item.categoryId,
              categoryName: item.categoryName,
              // 添加其他必要字段
              unit: item.unit || '个' // 默认单位为"个"
            }));

            this.$message.success(`成功加载${this.selectedGoods.length}个商品`);
          } else {
            this.$message.warning("该采购计划没有商品明细");
          }

          this.planListDialogVisible = false;
        }).catch(error => {
          console.error("获取采购计划详情失败:", error);
          this.$message.error("获取采购计划详情失败");
        });
      } else {
        this.$message.warning("请选择一个采购计划");
      }
    },
    handleCreatorChange(value) {
      if (value.length > 0) {
        // 获取选中项的最后一个值作为 id
        const selectedPerson = this.personList.find(person => person.id === value[value.length - 1]);
        if (selectedPerson) {
          this.form.creatorId = selectedPerson.id; // 保存编制人 ID 到表单
          this.form.creator = selectedPerson.realName; // 保存编制人名称到表单
        }
      } else {
        this.form.creatorId = null;
        this.form.creator = null;
      }
    },

    handleRemoveGoods(index) {
      this.selectedGoods.splice(index, 1);
    },

    /** 关闭合同操作 */
    handleCloseContract(row) {
      const ids = row.id || this.ids; // 获取选中的合同 ID
      this.$modal.confirm('是否确认关闭合同编号为"' + ids + '"的数据项？').then(() => {
        return updateContractStatus(ids, "已关闭"); // 调用更新合同状态的接口
      }).then(() => {
        this.getList(); // 刷新列表
        this.$modal.msgSuccess("关闭成功");
      }).catch(() => {});
    },

    /** 执行合同操作 */
    handleExecuteContract(row) {
      const ids = row.id || this.ids; // 获取选中的合同 ID
      this.$modal.confirm('是否确认执行合同编号为"' + ids + '"的数据项？').then(() => {
        return updateContractStatus(ids, "执行中"); // 调用更新合同状态的接口
      }).then(() => {
        this.getList(); // 刷新列表
        this.$modal.msgSuccess("执行成功");
      }).catch(() => {});
    },

    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          // 验证是否有商品明细
          if (this.selectedGoods.length === 0) {
            this.$message.warning("请至少添加一个商品明细");
            return;
          }

          // 准备商品明细数据
          this.form.esProcurementContractProductList = this.selectedGoods.map(item => ({
            goodsId: item.goodsId,
            goodsName: item.goodsName,
            goodsSn: item.goodsSn,
            specification: item.specification,
            price: item.price,
            num: item.num,
            taxRate: item.taxRate,
            remark: item.remark,
            totalPrice: this.calculateItemTotal(item),
            categoryId: item.categoryId,
            categoryName: item.categoryName,
            unit: item.unit || '个' // 确保unit字段有值
          }));

          console.log("完整提交数据:", JSON.stringify(this.form, null, 2));

          const operation = this.form.id ? updateContract(this.form) : addContract(this.form);

          operation.then(response => {
            console.log("操作成功响应:", response);
            this.$modal.msgSuccess(this.form.id ? "修改成功" : "新增成功");
            this.open = false;
            this.getList();
          }).catch(error => {
            console.error("操作失败:", error);
            this.$modal.msgError("操作失败: " + (error.message || error));
          });
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除采购合同(es_procurement_contract)编号为"' + ids + '"的数据项？').then(function() {
        return delContract(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 采购合同产品(es_procurement_contract_product)序号 */
    rowEsProcurementContractProductIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 采购合同产品(es_procurement_contract_product)添加按钮操作 */
    handleAddEsProcurementContractProduct() {
      let obj = {};
      obj.productId = "";
      obj.productName = "";
      obj.productSn = "";
      obj.specification = "";
      obj.categoryId = "";
      obj.categoryName = "";
      obj.unit = "";
      obj.barcode = "";
      obj.price = "";
      obj.num = "";
      obj.taxRate = "";
      obj.totalPrice = "";
      obj.stockNum = "";
      obj.goodsId = "";
      this.esProcurementContractProductList.push(obj);
    },
    /** 采购合同产品(es_procurement_contract_product)删除按钮操作 */
    handleDeleteEsProcurementContractProduct() {
      if (this.checkedEsProcurementContractProduct.length == 0) {
        this.$modal.msgError("请先选择要删除的采购合同产品(es_procurement_contract_product)数据");
      } else {
        const esProcurementContractProductList = this.esProcurementContractProductList;
        const checkedEsProcurementContractProduct = this.checkedEsProcurementContractProduct;
        this.esProcurementContractProductList = esProcurementContractProductList.filter(function(item) {
          return checkedEsProcurementContractProduct.indexOf(item.index) == -1
        });
      }
    },
    /** 复选框选中数据 */
    handleEsProcurementContractProductSelectionChange(selection) {
      this.checkedEsProcurementContractProduct = selection.map(item => item.index)
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('procurementmanagement/contract/export', {
        ...this.queryParams
      }, `contract_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style scoped>
/* 完全隐藏单选按钮的所有标签内容 */
.custom-radio ::v-deep .el-radio__label {
  display: none !important;
  width: 0;
  height: 0;
  overflow: hidden;
}
</style>
